<include file="__PUBLIC__/header"/>
<div class="page-container">
    <!--菜单-->
    <div class="cl pd-5 bg-1 bk-gray mt-10 mb-10">
        <span class="l c-red">通过模型管理建模后，不能手动去数据库修改或新增字段，否则被改动的字段将无法被管理。</span>
        <span class="r" style="line-height:1.6em;margin-top:3px"></span>
    </div>
    <!--列表-->
    <form class="form form-horizontal" id="form" method="post" action="{|U:'add'}">
        <div id="tab-system" class="HuiTab">
            <div class="tabBar cl">
                <span>基础</span><span>高级</span>
            </div>
            <div class="tabCon">

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">字段名：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="name" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">请输入字段名 英文字母开头，长度不超过30</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">字段标题：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="title" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">请输入字段标题，用于表单显示</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">字段类型：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="type" id="data-type" class="select">
                            <option value="">----请选择----</option>
                            <foreach from="$attribute_type" value="$type" key="$key">
                                <option value="{$key}" rule="{$type[1]}">{$type[0]}</option>
                            </foreach>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3">用于表单中的展示方式</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">字段定义：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="field" value="" id="data-field">
                    </div>
                    <div class="col-xs-3 col-sm-3">字段属性的sql表示</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">参数：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <textarea name="extra" class="textarea"></textarea>
                    </div>
                    <div class="col-xs-3 col-sm-3">布尔、枚举、多选字段类型的定义数据</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">默认值：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="value" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">字段的默认值</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">字段备注：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="remark" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">用于表单中的提示</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">是否显示：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="is_show" class="select">
                            <option value="1">始终显示</option>
                            <option value="2">新增显示</option>
                            <option value="3">编辑显示</option>
                            <option value="0">不显示</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3">是否显示在表单中</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">是否必填：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="is_must" class="select">
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3">用于自动验证</div>
                </div>
            </div>

            <div class="tabCon">

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">验证方式：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="validate_type" class="select">
                            <option value="regex">正则验证</option>
                            <option value="function">函数验证</option>
                            <option value="unique">唯一验证</option>
                            <option value="length">长度验证</option>
                            <option value="in">验证在范围内</option>
                            <option value="notin">验证不在范围内</option>
                            <option value="between">区间验证</option>
                            <option value="notbetween">不在区间验证</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3"></div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">验证规则：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="validate_rule" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">根据验证方式定义相关验证规则</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">出错提示：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="error_info" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3"></div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">验证时间：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="validate_time" class="select">
                            <option value="3">始 终</option>
                            <option value="1">新 增</option>
                            <option value="2">编 辑</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3"></div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">自动完成方式：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="auto_type" class="select">
                            <option value="function">函数</option>
                            <option value="field">字段</option>
                            <option value="string">字符串</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3"></div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">自动完成规则：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <input type="text" class="input-text" name="auto_rule" value="">
                    </div>
                    <div class="col-xs-3 col-sm-3">根据完成方式订阅相关规则</div>
                </div>

                <div class="row cl">
                    <label class="form-label col-xs-2 col-sm-2">自动完成时间：</label>
                    <div class="formControls col-xs-7 col-sm-7">
                        <div class="select-box">
                        <select name="auto_time" class="select">
                            <option value="3">始 终</option>
                            <option value="1">新 增</option>
                            <option value="2">编 辑</option>
                        </select>
                        </div>
                    </div>
                    <div class="col-xs-3 col-sm-3"></div>
                </div>
            </div>
            <input type="hidden" name="model_id" value="{$info['model_id']}"/>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9">
                <button type="submit" class="btn btn-primary radius"><i class="iconfont icon-duigou1"></i>&nbsp;确定&nbsp;</button>
            </div>
        </div>
    </form>
</div>
<include file="__PUBLIC__/footer"/>
<script>
    $(function(){
        $('#data-type').change(function(){
            $('#data-field').val($(this).find('option:selected').attr('rule'));
        });
        $.Huitab("#tab-system .tabBar span","#tab-system .tabCon","current","click","0");
        //表单提交
        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                ajax_progress(ret);
            }
        });
    });
</script>
</body>
</html>